from django.db import models
from myapp.models import User
from goods.models import Goods
# Create your models here.

# 用户收藏商品的模型类

class GoodCollection(models.Model):
    user = models.ForeignKey(User,on_delete=models.CASCADE,verbose_name='用户')
    good = models.ForeignKey(Goods,on_delete=models.CASCADE,verbose_name='商品')

    def __str__(self):
        return '%s 收藏了 %s 商品'%(self.user.username,self.good.sku_name)

    class Meta:
        db_table = 'good_collecion'
        verbose_name_plural = '商品收藏表'






